//
//  YDTransactionDetailTableHeaderView.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/10.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDTransactionDetailTableHeaderView.h"

@interface YDTransactionDetailTableHeaderView()

//指示器
@property (nonatomic , weak) UIView *indicatorView;
//交易类别
@property (nonatomic , weak) UILabel *transCate;
//分割线
@property (nonatomic , weak) UIView *lineView;
@end

@implementation YDTransactionDetailTableHeaderView

-(void)setCateString:(NSString *)cateString
{
    _cateString = cateString;
    
    self.transCate.text = cateString;
}

+ (instancetype)headerViewWithTableView:(UITableView *)tableView
{
    
    static NSString *transactionDetailTableHeaderView = @"YDTransactionDetailTableHeaderView";
    YDTransactionDetailTableHeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:transactionDetailTableHeaderView];
    if (headerView == nil) {
        headerView = [[YDTransactionDetailTableHeaderView alloc] initWithReuseIdentifier:transactionDetailTableHeaderView];
    }
    return headerView;
}


-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self lineView];
        [self indicatorView];
        [self transCate];
        
    }
    return self;
}
-(UIView *)lineView
{
    if (_lineView == nil) {
        UIView *lineView = [[UIView alloc] init];
        [self.contentView addSubview:lineView];
        lineView.backgroundColor = NumberColor(247, 247, 247);
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self);
            make.height.equalTo(@1);
        }];
        
        _lineView = lineView;
    }
    return _lineView;
}

-(UIView *)indicatorView
{
    if (_indicatorView == nil) {
        UIView *indicatorView = [[UIView alloc] init];
        [self.contentView addSubview:indicatorView];
        indicatorView.backgroundColor = NumberColor(113, 129, 200);
        [indicatorView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.left.equalTo(self);
            make.width.equalTo(@(rate375(4)));
            make.height.equalTo(self).multipliedBy(0.5);
        }];
        
        _indicatorView = indicatorView;
    }
    return _indicatorView;
}

-(UILabel *)transCate
{
    if (_transCate == nil) {
        UILabel *transCate = [[UILabel alloc] init];
        [self.contentView addSubview:transCate];
        transCate.font = [UIFont systemFontOfSize:font18ScreenWRate * LKScreenW];
        transCate.textColor = [UIColor colorWithHexString:dark];
        transCate.textAlignment = NSTextAlignmentLeft;
        [transCate mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.equalTo(self.indicatorView.mas_right).offset(rate375(11));
        }];
        _transCate = transCate;
    }
    return _transCate;
}



@end
